<?php

use yii\db\Migration;

class m000000_000014_create_user_config extends Migration
{
    public function up()
    {
        $this->createTable('{{%user_config}}', [
            'id'=>$this->primaryKey(), // PK
            'uid'=>$this->integer(), // 用户编号
            'k'=>$this->string(32), // 键
            'v'=>$this->text(), // 值
        ]);
        $this->createIndex('fk_user_config_user2_idx', '{{%user_config}}', ['uid']);
        try {
            $this->addForeignKey('fk_user_config_user2', '{{%user_config}}', ['uid'], '{{%user}}', ['id']);
        } catch (Exception $e) {
        }
    }

    public function down()
    {
        $this->dropTable('{{%user_config}}');
    }
}
